#include "pollThread.h"
#include <QDebug>

#define MAXSEC  30

enum {
    wPOLL,
    IDLE
};

pollThread::pollThread(QObject *parent) : QThread(parent)
{
    wadb_code = IDLE;
    waitsec = 0;
    //wprocess = new QProcess(this);
    //connect(wprocess,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(wonSearchFinished(int,QProcess::ExitStatus)));
}

void pollThread::stopThread()
{
   loop = 0;
}

void pollThread::run()
{

//    wadb_code = wPOLL;
//    wprocess->start(adbstr);
//    loop = 1;

    waitsec = 0;
    loop = 1;

    while (loop) {
        waitsec += 3;
        QThread::sleep (3);
        if (waitsec <= MAXSEC) {
            emit wiatfor1s(waitsec);
        }
        else {
            waitsec = 0;
            emit timeout();
        }
    }
}
